package com.xhh.stu.activity.impl;

import com.xhh.stu.activity.Activity;
import com.xhh.stu.cal.Calculate;
import com.xhh.stu.cal.factory.CalculateFactory;

/**
 * 活动-满减
 * <p>
 * 2017年1月4日 下午4:38:39
 * </p>
 * 
 * @author lijian
 * @version 1.0
 */
public class ActEnoughFree implements Activity {

	private double enoughMoney;// man
	private double freeMoney;// jian

	public ActEnoughFree(double enoughMoney, double freeMoney) {
		super();
		this.enoughMoney = enoughMoney;
		this.freeMoney = freeMoney;
	}

	public double getEnoughMoney() {
		return enoughMoney;
	}

	public void setEnoughMoney(double enoughMoney) {
		this.enoughMoney = enoughMoney;
	}

	public double getFreeMoney() {
		return freeMoney;
	}

	public void setFreeMoney(double freeMoney) {
		this.freeMoney = freeMoney;
	}

	@Override
	public double getMoney(double sourceMoney) {
		if (sourceMoney > enoughMoney) {
			Calculate cal = CalculateFactory.getCalCulateInstance("-");
			return cal.calculate(sourceMoney, ((int)(sourceMoney / enoughMoney)) * freeMoney);
		}
		return sourceMoney;
	}

}
